
CREATE TABLE T1_n78(key STRING, value STRING) STORED AS TEXTFILE;
LOAD DATA LOCAL INPATH '../../data/files/kv1.txt' INTO TABLE T1_n78;
LOAD DATA LOCAL INPATH '../../data/files/kv2.txt' INTO TABLE T1_n78;


CREATE TABLE T2_n47(key STRING, value STRING);

EXPLAIN 
INSERT OVERWRITE TABLE T2_n47 SELECT * FROM (SELECT * FROM T1_n78 DISTRIBUTE BY key) T ORDER BY key, value LIMIT 20;

INSERT OVERWRITE TABLE T2_n47 SELECT * FROM (SELECT * FROM T1_n78 DISTRIBUTE BY key) T ORDER BY key, value LIMIT 20;

SELECT * FROM T2_n47 ORDER BY key, value;



